import { Provide } from '@midwayjs/core';
import { Repository } from 'typeorm';
import { InjectEntityModel } from '@midwayjs/typeorm';
import { CompanyEntity } from '../entity/company.entity';
import { createRandomStr } from '../utils/tools';

@Provide()
export class CompanyService {

  @InjectEntityModel(CompanyEntity)
  companyMoel: Repository<CompanyEntity>;

  async createCompany(boss_phone: string, wx_open_id: string) {
    const company_code = createRandomStr(6);
    const currdate = new Date();

    return this.companyMoel.save({
      boss_phone,
      company_code,
      wx_open_id,
      
    });
  }
}
